lock screen before hibernating [12.04]

Posted by Emanuel Ey on Ask Ubuntu See other posts from Ask Ubuntu or by Emanuel Ey
Published on 2012-11-20T16:12:32Z Indexed on 2012/11/20 17:20 UTC
Read the original article Hit count: 374

Filed under:
|

So when i hibernate my laptop the screen doesn't lock automatically. To solve this if changed /etc/acpi/powerbtn.sh to contain:

su - myUsername -c "gnome-screensaver-command -l"
sudo pm-hibernate
exit 0

When running this file from a command line it works as intended (ie, lock the screen and then hibernate). Unfortunately, when pressing the power button, it still just hibernates without locking the screen -what am I missing?

EDIT: I've added the line whoami>>~/Desktop/test.txt to verify which user is executing the /etc/acpi/powerbtn.shscript. When pressing the power button, the file test.txt is created, but is empty. From this i conclude that the script is in fact being called when pressing the power button. What i do not understand is how the output of whoami can be empty...

© Ask Ubuntu or respective owner

Related posts about 12.04

Related posts about hibernate